package javaWeb;

import Bean.User;
import Service.Impl.MemberServiceImpl;
import Service.MemberService;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class LoginServlet extends HttpServlet {
    MemberService memberService = new MemberServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("LoginServlet登录成功");
//        String username = req.getParameter("user-name");
//        String password = req.getParameter("user-password");
//        System.out.println(username);
//        resp.setContentType("text/json:charset=utf-8");
//        if (memberService.LoginUser(username,password)){
//            req.setAttribute("isLogin",true);
//          req.getRequestDispatcher("/views/member/login_ok.html").forward(req,resp);
//        }else {
//           req.setAttribute("msg","用户或密码错误");
//           req.setAttribute("username",username);
//           req.getRequestDispatcher("/views/member/login.jsp").forward(req,resp);
//        }
    }
}
